<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="css/comm.css">
    <link rel="stylesheet" href="css/main.css">
    <title>Login</title>
</head>
<body>
    <div class="login_main" id="app">
        <div class="login_form">
            <div class="centerinput">
                <div>
                    <input type="text" name="account" v-model="account" placeholder="输入账号">
                    <input type="text" name="password" v-model="password" placeholder="输入密码">
                </div>
            </div>

            <div class="thirdlogin">
                <img src="imgs/qq.png" alt="QQ登陆">
                <img src="imgs/wechat.png" alt="微信登陆">
                <img src="imgs/weibo.png" alt="微博登陆">
            </div>

            <div class="login_btn">
                <input type="button" value="Login" @click='logining'>
                <input type="button" value="Cancel" @click='cancel'>
            </div>
        </div>
    </div>
</body>
<script src="js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            account: '',
            password: ''
        },
        methods: {
            logining: function () {
                var account = this.account,
                    pwd = this.password;
                axios.post('/login', {
                    account: account,
                    password: pwd
                }).then(function (response) {
                    if (response.data.url) {
                        window.location.href = response.data.url;
                    }
                });
            },
            cancel: function () {
                this.account = '';
                this.password = '';
            }
        }
    });
</script>
</html>